package com.pmcc.core.web;

import com.pmcc.core.entity.Role;
import com.pmcc.core.service.RoleService;
import com.pmcc.utils.AntdPage;
import com.pmcc.utils.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;

/**
 * 角色权限管理
 * Created by tomas on 18/9/4.
 */
@RestController()
@RequestMapping("api/v1/roles")
public class RoleController {

    @Autowired
    RoleService roleService;

    @GetMapping(value = "queryByPage")
    public ResultBean queryRoleByPage(AntdPage antdPage,Role model){
        return roleService.queryRoleByPage(antdPage, model);
    }

    @GetMapping(value = "addRole")
    public ResultBean addRole(String remark,String name,String code,String str,String str1){
        return roleService.addRole(remark, name, code, str, str1);
    }

    @PostMapping(value= "editRole")
    public ResultBean editRole(@RequestBody Map map) {
        return roleService.editRole(map);
    }

    @GetMapping("deleteRole")
    public ResultBean deleteRole(String id) {
        return roleService.deleteRole(id);
    }

    @GetMapping(value = "findAll")
    public ResultBean findAll(){
        return roleService.findAll();
    }
}
